/**
 * Created by user-007 on 2018/3/7.
 */
import request from '../utils/request';
import { formatRequestParamsString } from '../utils/utils';

/**
 * 列表
 * @param {Int} page 当前页数
 * @param {Int} pageSize 每页条数
 * @param {keyword} String 查询参数
 */
export async function get${className}List(params) {
  const query = formatRequestParamsString(params);
  return request(`/manage/${classname}/list${query}`);
}

/** 详情 */
export async function get${className}Detail(params) {
  return request(`/manage/${classname}/detail/${params}`);
}

/**
 * 添加
 * @param {*} params
 */
export async function add${className}(params) {
  return request('/manage/${classname}', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
    },
    body: JSON.stringify(params),
  });
}

/**
 * 更新
 * @param {*} params
 */
export async function update${className}(params) {
  return request('/manage/${classname}', {
    method: 'PUT',
    headers: {
      'Content-Type': 'application/json',
    },
    body: JSON.stringify(params),
  });
}

/** 删除 */
export async function delete${className}(params) {
  return request(`/manage/${classname}/${params}`, {
    method: 'DELETE',
  });
}